<template>
  <div class="box_bg">
        <h2 class="box_tit">
            <i class="icon icon1"></i>批改作业
            <i class="reti"></i>
        </h2>
        <div class="blank20"></div>
        <!-- 页面编辑页*****开始 -->
        <div class="goBack">
            <a href="JavaScript:void(0);" class="btns" @click="goBack">返回上一级</a>
        </div>
        <div class="blank20"></div>
        <div class="scrollBarX">
        <el-table  :data="correctClassList"  border stripe style="width: 100%">
            <el-table-column  prop="schoolName"  label="学校" align="center"></el-table-column>
            <el-table-column  prop="secondSchoolName"  label="学院"  align="center"></el-table-column>
            <el-table-column  prop="professionName"  label="专业" align="center"></el-table-column>
            <el-table-column  prop="gradeName"  label="年级" align="center"></el-table-column>
            <el-table-column  prop="shortName"  label="班级" align="center"></el-table-column>
            <el-table-column  prop="submittedCount"  label="已提交" align="center"></el-table-column>

            <el-table-column  :formatter="noSubmitCount"  label="未提交" align="center" width="80"> </el-table-column>
            <el-table-column  prop="" label="操作" align="center" width="100">
                <template slot-scope="scope">
                    <el-button @click="showStudentScoreDialog(scope.row.homeworkId,scope.row.classId)"  type="text" size="mini">批改作业</el-button>
                </template>
            </el-table-column>
        </el-table>
        </div>
       <update-student-score ref="updateStudentScore"></update-student-score>
  </div>
</template>
<script>
    import {enums} from '@/constant'
    import moment from 'moment'
    import update_student_score from './update-student-score'
    export default{
      components:{
        "update-student-score":update_student_score
      },
        data(){
            return {
                id:null,
                correctClassList:[],
            }
        },
        created(){
          this.getCorrectClass();
        },
        methods:{
            getCorrectClass(){
              let self = this;
                self.axios.get(api.homeworkTeacher.queryClass+"?homeworkId="+this.$route.params.id)
                .then((response) => {
                    if(response.data.success){
                        self.correctClassList = JSON.parse(JSON.stringify(response.data.data));
                    }else {
                        self.$message.error(response.data.msg);
                    }
                    
                });
            },
            noSubmitCount(row, column, cellValue){
              return row.titleCount-row.submittedCount;
            },
            showStudentScoreDialog(homeworkId,classId){
              console.log(homeworkId+"------>"+classId);
              this.$refs.updateStudentScore.showDialog(homeworkId,classId);
            },
            goBack(){
              this.$router.go(-1);
            },
        }
    }


</script>
<style scoped>

  .goBack{
    text-align: right;
    margin-right: 50px
}
</style>

